/*****************************************************************************
 * $LastChangedDate: 2009-11-22 22:39:11 -0500 (Sun, 22 Nov 2009) $
 * @file
 * @author  Jim E. Brooks  http://www.palomino3d.org
 * @brief   Craft class (base class for aircraft).
 *//*
 * LEGAL:   COPYRIGHT (C) 2007 JIM E. BROOKS
 *          THIS SOURCE CODE IS RELEASED UNDER THE TERMS
 *          OF THE GNU GENERAL PUBLIC LICENSE VERSION 2 (GPL 2).
 *****************************************************************************/

#define OBJECT_CRAFT_CC 1
#include "base/module.hh"
#include "base/random.hh"
#include "base/clamp.hh"
using namespace base;
#include "view/module.hh"
using namespace view;
#include "physics/module.hh"
#include "physics/physics_aircraft.hh"
using namespace physics;
#include "control/module.hh"
#include "control/conf.hh"
#include "control/command.hh"
#include "control/events.hh"
using namespace control;
#include "world/module.hh"
using namespace world;
#include "object/module.hh"
#include "object/defs.hh"
#include "object/craft.hh"

namespace object {

////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////  Craft  //////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

/*****************************************************************************
 * ctor/dtor.
 *****************************************************************************/
Craft::Craft( shptr<Graph> graph, const WorldVertex& pos )
:   Parent(graph,pos),
    mThrottle(0.0f)
{
    SET_TYPESIG(this,TYPESIG_CRAFT);
}

Craft::~Craft()
{
    INVALIDATE_TYPESIG(this,TYPESIG_CRAFT);
}

/*****************************************************************************
 * Reset.
 *****************************************************************************/
void
Craft::Reset( void )
{
CHECK_TYPESIG(this,TYPESIG_CRAFT);

    Parent::Reset();

    mThrottle = 0.0f;
}

/*****************************************************************************
 * Set throttle.
 * throttle = {0.0,..,1.0}
 * @param   throttle
 *          This method will clamp if necessary.
 *****************************************************************************/
void
Craft::SetThrottle( const fp throttle )
{
CHECK_TYPESIG(this,TYPESIG_CRAFT);

    mThrottle = Clamp1( throttle );
}

/*****************************************************************************
 * @return Throttle {0.0,..,1.0}.
 *****************************************************************************/
fp
Craft::GetThrottle( void )
{
CHECK_TYPESIG(this,TYPESIG_CRAFT);

    return mThrottle;
}

} // namespace object
